package com.durian.affairs.service.impl;

import java.util.List;

import com.durian.affairs.api.vo.CwDealPerDaySum;
import com.durian.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.durian.affairs.mapper.CwDealPerDayMapper;
import com.durian.affairs.api.domain.CwDealPerDay;
import com.durian.affairs.service.ICwDealPerDayService;

/**
 * 营业报表Service业务层处理
 * 
 * @author durian
 * @date 2022-06-22
 */
@Service
public class CwDealPerDayServiceImpl implements ICwDealPerDayService 
{
    @Autowired
    private CwDealPerDayMapper cwDealPerDayMapper;

    /**
     * 查询营业报表
     * 
     * @param id 营业报表主键
     * @return 营业报表
     */
    @Override
    public CwDealPerDay selectCwDealPerDayById(Long id)
    {
        return cwDealPerDayMapper.selectCwDealPerDayById(id);
    }

    /**
     * 查询营业报表列表
     * 
     * @param cwDealPerDay 营业报表
     * @return 营业报表
     */
    @Override
    public List<CwDealPerDay> selectCwDealPerDayList(CwDealPerDay cwDealPerDay)
    {
        return cwDealPerDayMapper.selectCwDealPerDayList(cwDealPerDay);
    }

    /**
     * 新增营业报表
     * 
     * @param cwDealPerDay 营业报表
     * @return 结果
     */
    @Override
    public int insertCwDealPerDay(CwDealPerDay cwDealPerDay)
    {
        cwDealPerDay.setCreateTime(DateUtils.getNowDate());
        return cwDealPerDayMapper.insertCwDealPerDay(cwDealPerDay);
    }

    /**
     * 修改营业报表
     * 
     * @param cwDealPerDay 营业报表
     * @return 结果
     */
    @Override
    public int updateCwDealPerDay(CwDealPerDay cwDealPerDay)
    {
        cwDealPerDay.setUpdateTime(DateUtils.getNowDate());
        return cwDealPerDayMapper.updateCwDealPerDay(cwDealPerDay);
    }

    /**
     * 批量删除营业报表
     * 
     * @param ids 需要删除的营业报表主键
     * @return 结果
     */
    @Override
    public int deleteCwDealPerDayByIds(Long[] ids)
    {
        return cwDealPerDayMapper.deleteCwDealPerDayByIds(ids);
    }

    /**
     * 删除营业报表信息
     * 
     * @param id 营业报表主键
     * @return 结果
     */
    @Override
    public int deleteCwDealPerDayById(Long id)
    {
        return cwDealPerDayMapper.deleteCwDealPerDayById(id);
    }

    @Override
    public CwDealPerDaySum getSummation(CwDealPerDay cwDealPerDay) {

        CwDealPerDaySum summation = cwDealPerDayMapper.getSummation(cwDealPerDay);
        return summation;
    }
}
